<template>
  <view class="content work-container">
    <view class="tab-swiper-wrapper">
      <wuc-tab
        :tab-list="taskStatusTabList"
        :tabCur.sync="currentTaskStatusTab"
        :textFlex="true"
        @change="taskStatusTabChange"
      ></wuc-tab>
      <swiper
        class="swiper-container"
        :current="currentTaskStatusTab"
        duration="300"
        @change="taskListSwiperChange"
      >
        <swiper-item v-for="(item, index) in taskList" :key="index">
          <view class="list-container" v-if="item.list.length > 0">
            <!-- <scheduleCard
              :data="data[index]"
              @handleComplete="handleComplete"
            />-->
            <scheduleCard :data="data" v-for="(data, i) in item.list" :key="i" />
          </view>
          <view class="no-content-container" v-else>
            <!-- <image src="../../static/images/me/zanwu.png" /> -->
            <text>暂无内容</text>
          </view>
        </swiper-item>
        <!-- <swiper-item>
          <view class="list-container">
             <scheduleCard :data="item" />
          </view>
        </swiper-item>-->
      </swiper>
    </view>
    <!-- <navigator url="/pages/scode/scode"> -->
    <view class="adds" @click="handleScode()">
      <image src="../../static/images/codes.png" mode="widthFix" />
    </view>
    <view class="add" @click="handleA()">
      <image src="../../static/images/addss.png" mode="widthFix" />
    </view>
    <!-- </navigator> -->
    <pop
      ref="pop"
      direction="center"
      :is_close="true"
      :is_mask="true"
      :width="80"
      height="fit-content"
      :maskFun="true"
      @watchOpen="watchOpen"
      @watchClose="watchClose"
    >
      <view class="center">
        <view>产品名称:xxx</view>
        <view>产品代码:xxx</view>
        <view>所属项目:xxx</view>
        <view>所属型号:xxx</view>
        <!-- <view>开始点检任务?</view> -->
        <view>设计位移:xxx</view>
        <view>设计温度:xxx</view>
        <view>设计压力:xxx</view>
        <view>波纹管壁厚:xxx</view>
        <view>介质:xxx</view>
        <view>开始检查任务?</view>
        <view>
          <button type="primary" @click="handleComplete">确定</button>
        </view>
      </view>
    </pop>
    <pop
      ref="pops"
      direction="center"
      :is_close="true"
      :is_mask="true"
      :width="80"
      height="fit-content"
      :maskFun="true"
      @watchOpen="watchOpen"
      @watchClose="watchClose"
    >
      <view class="form_wrap">
        <view class="form_item">
          <view class="form_label">
            <view class="required_flag">*</view>产品代码
          </view>
          <input
            class="item_value"
            type="text"
            name="name"
            v-model="code"
            placeholder="产品代码(必填)"
            placeholder-style="font-size: 28rpx;color: rgba(0, 0, 0, .3)"
          />
        </view>
        <view style="display:flex">
          <button type="default" @click="handelClose">取消</button>
          <button type="primary" @click="handleCom">确定</button>
        </view>
      </view>
    </pop>
  </view>
</template>
<script>
import pop from '@/components/ming-pop/ming-pop.vue'
import WucTab from '@/components/wuc-tab/wuc-tab.vue'
import { uniList, uniListItem } from '@dcloudio/uni-ui'
import scheduleCard from '@/components/scheduleCard/scheduleCard'
// import todoList from "../../leadership/todoList/todoList";
// import messagePush from "../../messagePush/messagePush";
export default {
  components: {
    WucTab,
    uniList,
    pop,
    // messagePush,
    uniListItem,
    scheduleCard
    // todoList
  },
  data() {
    return {
      code: '',
      // 当前选中的工单的状态
      currentTaskStatusTab: 0,
      // 工单不同的状态
      taskStatusTabList: [
        { name: '进行中' },
        { name: '已完成' },
        { name: '已取消' }
      ],
      taskList: [
        {
          name: '进行中',
          id: 1,
          list: [
            {
              id: 1,
              name: 'xxx',
              code: '20201120353',
              project: 'xxxxxxxxxxxxx',
              product: 'xxxxxxxxxxxxx222',
              status: 0
            },
            {
              id: 2,
              name: 'xxx',
              code: '2020112035313',
              project: 'xxxxxxxxxxxxx',
              product: 'xxxxxxxxxxxxx222',
              status: 1
            }
          ]
        },
        {
          name: '已完成',
          id: 2,
          list: [
            {
              name: 'xxx',
              code: '20201120353',
              project: 'xxxxxxxxxxxxx',
              product: 'xxxxxxxxxxxxx222',
              status: 1
            },
            {
              name: 'xxx',
              code: '20201120353',
              project: 'xxxxxxxxxxxxx',
              product: 'xxxxxxxxxxxxx222',
              status: 1
            }
          ]
        },
        {
          name: '已取消',
          id: 3,
          list: [
            {
              name: 'xxx',
              code: '20201120353',
              project: 'xxxxxxxxxxxxx',
              product: 'xxxxxxxxxxxxx222',
              status: 2
            },
            {
              name: 'xxx',
              code: '20201120353',
              project: 'xxxxxxxxxxxxx',
              product: 'xxxxxxxxxxxxx222',
              status: 2
            }
          ]
        }
      ],
      total: 0,
      pageNum: 1,
      pageSize: 9999999,
      data: [
        [
          {
            name: 'xxx',
            code: '20201120353',
            project: 'xxxxxxxxxxxxx',
            product: 'xxxxxxxxxxxxx222',
            status: 0
          },
          {
            name: 'xxx',
            code: '20201120353',
            project: 'xxxxxxxxxxxxx',
            product: 'xxxxxxxxxxxxx222',
            status: 1
          },
          {
            name: 'xxx',
            code: '20201120353',
            project: 'xxxxxxxxxxxxx',
            product: 'xxxxxxxxxxxxx222',
            status: 2
          },
          {
            name: 'xxx',
            code: '20201120353',
            project: 'xxxxxxxxxxxxx',
            product: 'xxxxxxxxxxxxx222',
            status: 0
          },
          {
            name: 'xxx',
            code: '20201120353',
            project: 'xxxxxxxxxxxxx',
            product: 'xxxxxxxxxxxxx222',
            status: 1
          },
          {
            name: 'xxx',
            code: '20201120353',
            project: 'xxxxxxxxxxxxx',
            product: 'xxxxxxxxxxxxx222',
            status: 2
          }
        ]
      ]
    }
  },
  onShow() {
    // this.gettaskPlan();
  },
  methods: {
    //  顶部tab切换
    taskStatusTabChange(index) {
      this.currentTaskStatusTab = index
      // if (this.currentTaskStatusTab === 0) {
      // } else if (this.currentTaskStatusTab === 1) {
      //   this.isShows = true;
      //   this.isShowss = false;
      //   this.isShow = false;
      // } else if (this.currentTaskStatusTab === 2) {
      //   this.isShowss = true;
      //   this.isShows = false;
      //   this.isShow = false;
      // }
    },
    taskListSwiperChange(e) {
      this.currentTaskStatusTab = e.target.current
      // if (this.currentTaskStatusTab === 0) {
      //   this.isShow = true;
      // } else if (this.currentTaskStatusTab === 1) {
      //   this.isShows = true;
      //   this.isShowss = false;
      //   this.isShow = false;
      // } else if (this.currentTaskStatusTab === 2) {
      //   this.isShowss = true;
      //   this.isShows = false;
      //   this.isShow = false;
      // }
    },
    handleScode() {
      //         uni.scanCode({
      //  	onlyFromCamera: true,//只允许拍照，不允许本地相册
      // 	scanType:["qrCode"],//扫码类型 以为 二位 xxx
      //     success:  (res)=> {
      //     }
      // });
      // this.$refs.pop.show()
      uni.scanCode({
        success: function(res) {
        }
      })
      // this.$refs.pop.show()
    },
    handleComplete() {
      this.$refs.pop.close()
      uni.navigateTo({
        url: '/pages/detail/detail'
      })
    },
    handleA() {
      this.$refs.pops.show()
    },
    handelClose() {
      this.$refs.pops.close()
    },
    handleCom() {
      this.$refs.pops.close()
      this.$refs.pop.show()
    }
    // handleComplete(e) {
    //   var _this = this;
    //   uni.showModal({
    //     title: "确认",
    //     content: "该日程已完成?",
    //     cancelText: "取消",
    //     confirmText: "确认",
    //     success: function(res) {
    //       if (res.confirm) {
    //         var del = _this.data[0].splice(e, 1);
    //         del[0].isShow = true;
    //         _this.data[1] = del.concat(_this.data[1]);
    //       } else if (res.cancel) {
    //       }
    //     }
    //   });
    // }
  }
}
</script>

<style lang="scss" scoped>
.form_wrap {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
}
.form_item {
  display: flex;
  background: #ffffff;
  flex-direction: row;
  align-items: center;
  padding: 20rpx;
  // border-bottom: 1px solid #e5e5e5;
  .form_label {
    // flex: 1;
    text-align: end;
    font-size: 28rpx;
    color: #657180;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    .required_flag {
      color: red;
      margin-right: 10rpx;
    }
  }
}
.item_value {
  flex: 2;
  border: 1px solid #e0e3e7;
  border-radius: 10rpx;
  margin-left: 50rpx;
  padding: 10rpx 0;
  font-size: 28rpx;
  .pickerInput {
    padding: 0;
  }
}
.content {
  padding-bottom: 0;
}
.work-container {
  height: 95%;
  .tab-swiper-wrapper {
    width: 100%;
    height: 100%;
    .swiper-container {
      height: calc(100% - 90rpx);
      background-color: #f6f6f8;
      // .scroll-container {
      //   height: 100%;
      .list-container {
        height: 100%;
        overflow: auto;
      }
      .no-content-container {
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        image {
          width: 300rpx;
          height: 260rpx;
        }
        text {
          color: #bfbfbf;
        }
      }
    }
  }
}
.add {
  position: absolute;
  bottom: 100rpx;
  right: 50rpx;
  image {
    width: 80rpx;
    height: 80rpx;
  }
}
.adds {
  position: absolute;
  bottom: 200rpx;
  right: 53rpx;
  image {
    width: 75rpx;
    height: 75rpx;
  }
}
.center {
  // margin-left: 100rpx;
  text-align: center;
}
uni-button {
  margin-top: 20rpx;
  font-size: 12px;
  width: 100px;
}
</style>